#ifndef MONITOR_CREATE_ACCOUNT_H_
#define MONITOR_CREATE_ACCOUNT_H_
#include <gtkmm/button.h>
#include <gtkmm/window.h>
#include <gtkmm/box.h>
#include <gtkmm/entry.h>
#include <gtkmm/messagedialog.h>
#include <string>
using namespace std;
class CreateAccount: public Gtk::Window {
private:
	Gtk::VBox box;
	Gtk::HBox hbox;
	Gtk::Entry user_entry, pass_entry;
	Gtk::Button accept_button, cancel_button;
	Gtk::Label user_label,pass_label;
	Monitor* m;
public:
	CreateAccount(Monitor* m) : user_label("Enter new account username:"), pass_label("Enter new account password:"),
			accept_button("Accept"), cancel_button("Cancel"), box(true,0) {
		set_title("Account Creation");
		this->m = m;
		set_modal(true);
		accept_button.signal_clicked().connect(
				sigc::mem_fun(*this, &CreateAccount::on_accept_clicked));
		cancel_button.signal_clicked().connect(
				sigc::mem_fun(*this, &CreateAccount::on_cancel_clicked));
		user_entry.set_max_length(12);
		pass_entry.set_max_length(12);
		pass_entry.property_visibility()=false;

		add(box);
		box.pack_start(user_label);
		box.pack_start(user_entry);
		box.pack_start(pass_label);
		box.pack_start(pass_entry);
		box.pack_start(hbox);
		hbox.pack_start(accept_button);
		hbox.pack_start(cancel_button);
		show_all_children();
	}

	void on_accept_clicked() {
		string user = user_entry.get_text();
		string pass = pass_entry.get_text();
		Gtk::MessageDialog dialog(*this, m->CreateAccount(&user, &pass));
		dialog.run();
		Gtk::Main::quit();
	}

	void on_cancel_clicked() {
		Gtk::Main::quit();
	}

};

#endif /* MONITOR_CREATE_ACCOUNT_H_ */
